//
//  TAMTNewsListTopView.swift
//  TAMeetApp
//
//  Created by 九月 on 12/5/24.
//

import UIKit

class TAMTNewsListTopView: UICollectionReusableView {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        let values:[String] = ["群聊广场=group", "回复中心=hudong", "群动态=square", "系统通知=notice"]

        
        for i in 0...values.count-1 {

            let str:String = values[i]
            let strValues = str.split(separator: "=").map(String.init)
            
            let btn = UIButton(type: .custom)
            btn.width = (self.width - 24) * 0.25
            btn.height = self.height
            btn.setTitle(strValues.first, for: .normal)
            btn.setTitleColor(UIColor(red: 51/255.0, green: 51/255.0, blue: 51/255.0, alpha: 1), for: .normal)
            btn.titleLabel?.font = .systemFont(ofSize: 14, weight: .medium)
            btn.setImage(UIImage(named: strValues.last!), for: .normal)
            btn.left = 12 + CGFloat(i)*btn.width
            btn.top = 0;
            btn.setImageAboveText()
            addSubview(btn)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
